soup: Hold a ref to the pending URI during completion processing
authorColin Walters <walters@verbum.org>
Mon, 3 Apr 2017 16:46:37 +0000 (12:46 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 5 Apr 2017 20:44:11 +0000 (20:44 +0000)
commit89d663d94a12439ecc5ab0cc68b13e92906309c2
treea99ae7f1ee0bf4aff597d085d01c9e94edc93a84
parenta0e15ecbedcfe86e544fb74f1d909af0d43ddbf9
soup: Hold a ref to the pending URI during completion processing

It was reported that in the range request handling, we called `remove_pending()`
twice (once in processing it, and once potentially in the local_error cleanup),
and this could be viewed as a use-after-free. However, right now the range
cleanup and `local_error` being set are mututally exclusive.
Further, the task object already holds a strong reference, so I observed the
refcount was 2. For both of these reasons, there is no use-after-free in
practice.

Reported-By: "Siddharth Sharma" <siddharth@redhat.com>
Closes: #774
Approved by: jlebon
src/libostree/ostree-fetcher-soup.c